package pers.vinsonws.jianghu.tools;

import pers.vinsonws.jianghu.util.MessageLabel;

import java.util.ArrayList;
import java.util.List;

/**
 * @auther vinsonws
 * @date 2018/11/7 22:35
 */
public class DivisMessage {
    private String[] strings = null;
    private int length = 0;

    public DivisMessage(String message, int type) {
        if ((MessageLabel.getLabel(type) == null)) throw new NullPointerException("Label NullPointer");
        strings = message.split(MessageLabel.getLabel(type));
        length = strings.length - 1;
    }

    public String getStrByIndex(int index){
        if (index <= 0 || index >length) throw new IllegalStateException("Illegality Index");
        return strings[index];
    }
    public int getLength() {
        return length;
    }
}
